export default function (module, __webpack_exports__, __webpack_require__) {

    "use strict";
    var core_js_modules_es_array_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("99af");
    var core_js_modules_es_array_concat__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat__WEBPACK_IMPORTED_MODULE_0__);
    var core_js_modules_es_function_name__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("b0c0");
    var core_js_modules_es_function_name__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name__WEBPACK_IMPORTED_MODULE_1__);
    var core_js_modules_es_number_to_fixed__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("b680");
    var core_js_modules_es_number_to_fixed__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_to_fixed__WEBPACK_IMPORTED_MODULE_2__);
    var E_Project_wallmap_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("5530");
    var E_Project_wallmap_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("2909");
    var E_Project_wallmap_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("b85c");
    var _privateApi_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("94f7");

    /**
    * 地图打点api
    */
    /* harmony default export */
    __webpack_exports__["a"] = ({
        methods: {
            /**
            * 添加飞线-自定义材质
            * @param {Object} start 起点 {lon, lat}
            * @param {Object} end 终点 {lon, lat}
            * @param {Array} rgb 颜色 
            * @param {Object} option 配置项 可选
            */
            createFlylineCz: function createFlylineCz(start, end) {
                var _Cesium$Color;

                var rgb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [255, 255, 0.0];
                var option = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
                var height = option.height;

                function PolylineTrailLinkMaterialProperty(color, duration) {
                    this._definitionChanged = new Cesium.Event();
                    this._color = undefined;
                    this._colorSubscription = undefined;
                    this.color = color;
                    this.duration = duration;
                    this._time = new Date().getTime();
                }

                Object.defineProperties(PolylineTrailLinkMaterialProperty.prototype, {
                    isConstant: {
                        get: function get() {
                            return false;
                        }
                    },
                    definitionChanged: {
                        get: function get() {
                            return this._definitionChanged;
                        }
                    },
                    color: Cesium.createPropertyDescriptor("color")
                });

                PolylineTrailLinkMaterialProperty.prototype.getType = function (time) {
                    return "PolylineTrailLink";
                };

                PolylineTrailLinkMaterialProperty.prototype.getValue = function (time, result) {
                    if (!Cesium.defined(result)) {
                        result = {};
                    }

                    result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
                    result.image = appMaterial.PolylineTrailLinkImage;
                    result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
                    return result;
                };

                PolylineTrailLinkMaterialProperty.prototype.equals = function (other) {
                    return this === other || other instanceof PolylineTrailLinkMaterialProperty && Property.equals(this._color, other._color);
                };

                Cesium.PolylineTrailLinkMaterialProperty = PolylineTrailLinkMaterialProperty;
                var appMaterial = {};
                appMaterial.PolylineTrailLinkType = "PolylineTrailLink";
                appMaterial.PolylineTrailLinkImage = './img/flyline.png'; // Cesium.Material.PolylineTrailLinkImage = require('../../assets/images/flyline/test.png');
                // Cesium.Material.PolylineTrailLinkImage = "https://images.xiaozhuanlan.com/photo/2020/9baa5fef8c2b1898e047e1af12a20d1b.png";

                appMaterial.PolylineTrailLinkSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
                                           {\n\
                                               czm_material material = czm_getDefaultMaterial(materialInput);\n\
                                               vec2 st = materialInput.st;\n\
                                               vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n\
                                               material.alpha = colorImage.a * color.a;\n\
                                               material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
                                               return material;\n\
                                           }";

                Cesium.Material._materialCache.addMaterial(appMaterial.PolylineTrailLinkType, {
                    fabric: {
                        type: appMaterial.PolylineTrailLinkType,
                        uniforms: {
                            color: new Cesium.Color(1.0, 0.0, 0.0, 0.5),
                            image: appMaterial.PolylineTrailLinkImage,
                            time: 0
                        },
                        source: appMaterial.PolylineTrailLinkSource
                    },
                    translucent: function translucent(material) {
                        return true;
                    }
                }); // 飞线数据


                var flylines = Object(_privateApi_index__WEBPACK_IMPORTED_MODULE_6__[/* getFlyLineData */ "e"])(start, end, height);
                var arr = [];

                var _iterator = Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(flylines),
                    _step;

                try {
                    for (_iterator.s(); !(_step = _iterator.n()).done;) {
                        var item = _step.value;
                        arr.push(Cesium.Math.toDegrees(item[0]));
                        arr.push(Cesium.Math.toDegrees(item[1]));
                        arr.push(item[2]);
                    }
                } catch (err) {
                    _iterator.e(err);
                } finally {
                    _iterator.f();
                }

                var positions = Cesium.Cartesian3.fromDegreesArrayHeights(arr);
                var material = new Cesium.PolylineTrailLinkMaterialProperty((_Cesium$Color = Cesium.Color).fromBytes.apply(_Cesium$Color, Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(rgb).concat([255])), 3000);
                var entity = Object(_privateApi_index__WEBPACK_IMPORTED_MODULE_6__[/* addLine */ "b"])(positions, material, option);
                return entity;
            },

            /**
            * 添加实线
            * @param {Array} position 经纬度坐标 [lon,lat, ..., lon,lat] 至少二个经纬度坐标
            * @param {Object} option 配置项 可选
            */
            addSoildLine: function addSoildLine(position) {
                var _Cesium$Color2;

                var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
                var color = option.color ? (_Cesium$Color2 = Cesium.Color).fromBytes.apply(_Cesium$Color2, Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(option.color)) : Cesium.Color.RED;
                var positions = Cesium.Cartesian3.fromDegreesArray(position); // let material = new Cesium.PolylineArrowMaterialProperty(color)  // 带箭头的线

                var material = color;
                var entity = Object(_privateApi_index__WEBPACK_IMPORTED_MODULE_6__[/* addLine */ "b"])(positions, material, option);
                return entity;
            },

            /**
            * 绘制线路
            * @param {Object} viewer 图层视图
            * @param {String} name  线路名称 
            * @param {Array} color 线路颜色 可选
            * @param {Number} color 线路宽度 可选
            */
            DrawSoildLine: function DrawSoildLine(viewer, names, color, width) {
                var _Cesium$Color3;

                var that = this; // var positionList = [], lineEntity = null;

                var layerLine = undefined;
                document.body.style.cursor = 'crosshair'; // 鼠标

                var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); // 线路配置项

                var option = {
                    name: names,
                    color: color ? (_Cesium$Color3 = Cesium.Color).fromBytes.apply(_Cesium$Color3, Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(color)) : Cesium.Color.RED,
                    width: width
                };
                var layer = new Cesium.CustomDataSource('MyLines');
                viewer.dataSources.add(layer);
                var activeShapePoints = [],
                    activeShape = undefined; // 鼠标左键单击画点

                handler.setInputAction(function (click) {
                    var earthPosition = that.getPosition(viewer, click.position);

                    if (Cesium.defined(earthPosition)) {
                        if (activeShapePoints.length === 0) {
                            activeShapePoints.push(earthPosition);
                            var dynamicPositions = new Cesium.CallbackProperty(function () {
                                return activeShapePoints;
                            }, false);
                            activeShape = that.drawLine(layer, dynamicPositions, option);
                        }

                        activeShapePoints.push(earthPosition);
                    }
                }, Cesium.ScreenSpaceEventType.LEFT_CLICK); // 鼠标移动

                handler.setInputAction(function (move) {
                    if (activeShapePoints.length >= 2) {
                        var earthPosition = that.getPosition(viewer, move.endPosition);

                        if (Cesium.defined(earthPosition)) {
                            activeShapePoints.pop();
                            activeShapePoints.push(earthPosition);
                        }
                    }
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); // 单击鼠标右键结束画线

                handler.setInputAction(function (click) {
                    handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                    activeShapePoints.pop();
                    layer.entities.remove(activeShape);
                    layerLine = that.drawLine(layer, activeShapePoints, option);
                    document.body.style.cursor = 'default'; // 移除监听事件

                    setTimeout(function () {
                        activeShapePoints = [];
                        handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
                        handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
                        handler = handler && handler.destroy();
                    }, 500);
                }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
                return layerLine;
            },

            /**
            * 添加鼠标点击事件的位置
            * @param {Cesium.Viewer} viewer 目标地图
            * @param {Cesium.Cartesian2} position 鼠标位置
            * @return {Cesium.Cartesian3} 鼠标点击位置的坐标
            */
            getPosition: function getPosition(viewer, position) {
                var earthPosition = undefined; // 球面

                if (viewer.terrainProvider instanceof Cesium.EllipsoidTerrainProvider) {
                    earthPosition = viewer.scene.camera.pickEllipsoid(position);
                } // 地形
                else {
                    var ray = viewer.camera.getPickRay(position);
                    earthPosition = viewer.scene.globe.pick(ray, viewer.scene);
                }

                return earthPosition;
            },
            drawLine: function drawLine(layer, positionData, option) {
                return layer.entities.add({
                    name: option.name,
                    polyline: {
                        positions: positionData,
                        clampToGround: true,
                        width: option.width,
                        material: option.color
                    }
                });
            },
            removeDrawLine: function removeDrawLine(viewer) {
                viewer.dataSources.removeAll();
            },

            /**
            * 添加虚线
            * @param {Object} start 起点 {lon, lat}
            * @param {Object} end 终点 {lon, lat}
            * @param {Object} option 配置项 可选
            */
            drawDashedLine: function drawDashedLine(start, end) {
                var _Cesium$Color4;

                var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
                var arr = [start.lon, start.lat, end.lon, end.lat];
                var color = option.color ? (_Cesium$Color4 = Cesium.Color).fromBytes.apply(_Cesium$Color4, Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(option.color)) : Cesium.Color.RED;
                var dashLength = option.dashLength ? option.dashLength : 15.0;
                var positions = Cesium.Cartesian3.fromDegreesArray(arr);
                var material = new Cesium.PolylineDashMaterialProperty({
                    color: color,
                    dashLength: dashLength
                });
                var entity = Object(_privateApi_index__WEBPACK_IMPORTED_MODULE_6__[/* addLine */ "b"])(positions, material, option);
                return entity;
            },

            /**
            * 图标飞线
            * @param {Object} startLonLat 起点 {lon, lat}
            * @param {Object} endLonLat 终点 {lon, lat
            * @param {String} name 名称
            * @param {Array} color 线颜色
            * @param {Number} width 线宽度
            * @param {String} imgUrl 图标路径
            * @param {Number} scale 图标大小
            */
            createFlylineJt: function createFlylineJt(startLonLat, endLonLat, _ref) {
                var _Cesium$Color5;

                var _ref$name = _ref.name,
                    name = _ref$name === void 0 ? 'Line' : _ref$name,
                    _ref$color = _ref.color,
                    color = _ref$color === void 0 ? [0, 255, 0, 255] : _ref$color,
                    _ref$width = _ref.width,
                    width = _ref$width === void 0 ? 1 : _ref$width,
                    height = _ref.height,
                    _ref$imgUrl = _ref.imgUrl,
                    imgUrl = _ref$imgUrl === void 0 ? './img/jt.png' : _ref$imgUrl,
                    _ref$scale = _ref.scale,
                    scale = _ref$scale === void 0 ? 0.7 : _ref$scale;
                var data = Object(_privateApi_index__WEBPACK_IMPORTED_MODULE_6__[/* getFlyLineData */ "e"])(startLonLat, endLonLat, height);
                var lineData = getLineData(data);

                function getLineData(sData) {
                    if (!sData || !sData.length) return;
                    var centerPoint = sData[Math.floor(sData.length / 2)];
                    var centerData = {
                        lon: Cesium.Math.toDegrees(centerPoint[0]),
                        lat: Cesium.Math.toDegrees(centerPoint[1]),
                        height: Cesium.Math.toDegrees(centerPoint[2])
                    };
                    var lineData = [{
                        lon: startLonLat.lon,
                        lat: startLonLat.lat,
                        height: 0
                    }, Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])({}, centerData), {
                        lon: endLonLat.lon,
                        lat: endLonLat.lat,
                        height: 0
                    }];
                    return lineData;
                } //Set bounds of our simulation time


                var start = Cesium.JulianDate.fromDate(new Date(2015, 2, 25, 16));
                var stop = Cesium.JulianDate.addSeconds(start, 30, new Cesium.JulianDate()); //Make sure viewer is at the desired time.

                viewer.clock.startTime = start.clone();
                viewer.clock.stopTime = stop.clone();
                viewer.clock.currentTime = start.clone();
                viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the end

                viewer.clock.multiplier = 10; //Generate a random circular pattern with varying heights.
                //Generate a random circular pattern with varying heights.

                function computeCirclularFlight(lineData) {
                    var property = new Cesium.SampledPositionProperty();

                    for (var i = 0; i <= 20; i += 10) {
                        var time = Cesium.JulianDate.addSeconds(start, i, new Cesium.JulianDate());
                        var position = Cesium.Cartesian3.fromDegrees( // lineData[i / 10].lon + Math.cos(lineData[i / 10].radians),
                            // lineData[i / 10].lat + Math.sin(lineData[i / 10].radians),
                            // 0
                            lineData[i / 10].lon, lineData[i / 10].lat, lineData[i / 10].height);
                        property.addSample(time, position);
                    }

                    return property;
                } //Compute the entity position property.


                var position = computeCirclularFlight(lineData);
                var entity = viewer.entities.add({
                    name: name,
                    //Set the entity availability to the same interval as the simulation time.
                    availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
                        start: start,
                        stop: stop
                    })]),
                    //Use our computed positions
                    position: position,
                    //Load the Cesium plane model to represent the entity
                    // model: {
                    //   uri: jt,
                    //   minimumPixelSize: 24,
                    // },
                    billboard: {
                        image: imgUrl,
                        scale: scale
                    },
                    //Show the path as a pink line sampled in 1 second increments.
                    path: {
                        resolution: 1,
                        material: new Cesium.ColorMaterialProperty((_Cesium$Color5 = Cesium.Color).fromBytes.apply(_Cesium$Color5, Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(color))),
                        width: width
                    }
                });
                entity.position.setInterpolationOptions({
                    interpolationDegree: 5,
                    interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
                });
            },

            /**
            * 飞线-两头尖
            * @param {Object} start 起点 {lon, lat}
            * @param {Object} end 终点 {lon, lat
            * @param {Object} rgb 线颜色 {r, g, b}
            * @param {Number} speed 速度
            */
            addFlyline: function addFlyline(start, end, _ref2) {
                var _ref2$rgb = _ref2.rgb,
                    rgb = _ref2$rgb === void 0 ? {
                        r: 1.0,
                        g: 0.0,
                        b: 0.0
                    } : _ref2$rgb,
                    height = _ref2.height,
                    _ref2$speed = _ref2.speed,
                    speed = _ref2$speed === void 0 ? 5 : _ref2$speed;
                var lineData = Object(_privateApi_index__WEBPACK_IMPORTED_MODULE_6__[/* getFlyLineData */ "e"])(start, end, height);
                var arrAll = [];

                var _iterator2 = Object(E_Project_wallmap_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(lineData),
                    _step2;

                try {
                    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
                        var ite = _step2.value;
                        arrAll.push(Cesium.Math.toDegrees(ite[0]));
                        arrAll.push(Cesium.Math.toDegrees(ite[1]));
                        arrAll.push(ite[2]);
                    }
                } catch (err) {
                    _iterator2.e(err);
                } finally {
                    _iterator2.f();
                }

                var positions = Cesium.Cartesian3.fromDegreesArrayHeights(arrAll); // 创建长方体对象

                var PolylineGeometry = new Cesium.PolylineGeometry({
                    positions: positions,
                    width: 2
                });
                var instance = new Cesium.GeometryInstance({
                    geometry: PolylineGeometry,
                    id: "flyline"
                });
                var primitive = viewer.scene.primitives.add(new Cesium.Primitive({
                    geometryInstances: [instance],
                    appearance: this.getFlylineMaterial(1, rgb, speed),
                    releaseGeometryInstances: false,
                    compressVertices: false // vertexFormat: Cesium.PolylineMaterialAppearance.VERTEX_FORMAT
                    // vertexFormat: Cesium.VertexFormat.ALL,

                }));

                primitive.remove = function () {
                    viewer.scene.primitives.remove(this);
                };

                return primitive;
            },
            // 编辑飞线材质
            getFlylineMaterial: function getFlylineMaterial(type, rgb, speed) {
                var r = rgb.r.toFixed(2);
                var g = rgb.g.toFixed(2);
                var b = rgb.b.toFixed(2);
                speed = speed.toFixed(2); // 创建材质，在MaterialAppearance中若不添加基础材质，模型将会透明

                var material = new Cesium.Material.fromType("Color");
                material.uniforms.color = Cesium.Color.ORANGE; // 飞线效果-卡巴斯基 宽度 4

                var fragmentShaderSource1 = " \t\t\n                  varying vec2 v_st;\t\n                  varying float v_width;\t\n                  varying float v_polylineAngle;\n                  varying vec4 v_positionEC;\n                  varying vec3 v_normalEC;\n                  void main()\n                  {\n                      vec2 st = v_st;\n                      \n                      //\u5361\u5DF4\u65AF\u57FA\n                      float xx = sin(st.s*6.0 -czm_frameNumber/".concat(speed, ") - cos(st.t*6.0);\n                      float r = ").concat(r, ";\n                      float g = ").concat(g, ";\n                      float b = ").concat(b, ";\n                      float a = xx;\n\n                      gl_FragColor = vec4(r,g,b,a);\n                  }\n\n  "); // 飞线效果-箭头飞线，宽度 8

                var fragmentShaderSource2 = " \t\t\n                  varying vec2 v_st;\t\n                  varying float v_width;\t\n                  varying float v_polylineAngle;\n                  varying vec4 v_positionEC;\n                  varying vec3 v_normalEC;\n                  void main()\n                  {\n                      vec2 st = v_st;\n                      // \u7BAD\u5934\u98DE\u7EBF\uFF0C\u5BBD\u5EA6 8\n                      float xx = fract(st.s*10.0 + st.t  - czm_frameNumber/60.0);\n                      if (st.t<0.5) {\n                          xx = fract(st.s*10.0 - st.t - czm_frameNumber/60.0);\n                      }\n                      float r = 0.0;\n                      float g = xx;\n                      float b = xx;\n                      float a = xx;\n\n                      // \u98DE\u7EBF\u8FB9\u6846\n                      if (st.t>0.8||st.t<0.2) {\n                          g = 1.0;\n                          b = 1.0;\n                          a = 0.4;\n                      }\n\n                      gl_FragColor = vec4(r,g,b,a);\n                  }\n\n  "; // 飞线效果-七彩渐变飞线，宽度2

                var fragmentShaderSource3 = " \t\t\n                  varying vec2 v_st;\t\n                  varying float v_width;\t\n                  varying float v_polylineAngle;\n                  varying vec4 v_positionEC;\n                  varying vec3 v_normalEC;\n                  void main()\n                  {\n                      vec2 st = v_st;\n\n                      // \u4E03\u5F69\u6E10\u53D8\u98DE\u7EBF\uFF0C\u5BBD\u5EA62\n                      float xx = fract(st.s*2.0 - czm_frameNumber/60.0);\n                      float r = xx;\n                      float g = sin(czm_frameNumber/30.0);\n                      float b = cos(czm_frameNumber/30.0);\n                      float a = xx;\n\n                      gl_FragColor = vec4(r,g,b,a);\n                  }\n\n          "; // 飞线效果-飞线间隔，宽度2

                var fragmentShaderSource4 = " \t\t\n                  varying vec2 v_st;\t\n                  varying float v_width;\t\n                  varying float v_polylineAngle;\n                  varying vec4 v_positionEC;\n                  varying vec3 v_normalEC;\n                  void main()\n                  {\n                      vec2 st = v_st;\n\n                      float num = 4.0;//\u6BB5\u6570\n                      float second = 1.0;//\u79D2\u6570\n                      float speed = (60.0*second)/num;\n                      float xx = fract(st.s*num - czm_frameNumber/speed);\n                      float r = xx;\n                      float g = 0.0;\n                      float b = 0.0;\n                      float a = xx;\n                      if(fract(st.s - czm_frameNumber/(speed*num))<(1.0 - 1.0/num)){\n                          a=0.0;\n                      }\n                      gl_FragColor = vec4(r,g,b,a);\n                  }\n\n  "; // 自定义材质

                var aper = new Cesium.PolylineMaterialAppearance({
                    material: material,
                    translucent: true,
                    vertexShaderSource: "\n                  #define CLIP_POLYLINE \n                  void clipLineSegmentToNearPlane(\n                      vec3 p0,\n                      vec3 p1,\n                      out vec4 positionWC,\n                      out bool clipped,\n                      out bool culledByNearPlane,\n                      out vec4 clippedPositionEC)\n                  {\n                      culledByNearPlane = false;\n                      clipped = false;\n                      vec3 p0ToP1 = p1 - p0;\n                      float magnitude = length(p0ToP1);\n                      vec3 direction = normalize(p0ToP1);\n                      float endPoint0Distance =  czm_currentFrustum.x + p0.z;\n                      float denominator = -direction.z;\n                      if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)\n                      {\n                          culledByNearPlane = true;\n                      }\n                      else if (endPoint0Distance > 0.0)\n                      {\n                          float t = endPoint0Distance / denominator;\n                          if (t < 0.0 || t > magnitude)\n                          {\n                              culledByNearPlane = true;\n                          }\n                          else\n                          {\n                              p0 = p0 + t * direction;\n                              p0.z = min(p0.z, -czm_currentFrustum.x);\n                              clipped = true;\n                          }\n                      }\n                      clippedPositionEC = vec4(p0, 1.0);\n                      positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);\n                  }\n                  vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n                  {\n                      #ifdef POLYLINE_DASH\n                      vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\n                      vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\n                      vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\n                      vec2 lineDir;\n                      if (usePrevious) {\n                          lineDir = normalize(positionWindow.xy - previousWindow.xy);\n                      }\n                      else {\n                          lineDir = normalize(nextWindow.xy - positionWindow.xy);\n                      }\n                      angle = atan(lineDir.x, lineDir.y) - 1.570796327;\n                      angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n                      #endif\n                      vec4 clippedPrevWC, clippedPrevEC;\n                      bool prevSegmentClipped, prevSegmentCulled;\n                      clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);\n                      vec4 clippedNextWC, clippedNextEC;\n                      bool nextSegmentClipped, nextSegmentCulled;\n                      clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);\n                      bool segmentClipped, segmentCulled;\n                      vec4 clippedPositionWC, clippedPositionEC;\n                      clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);\n                      if (segmentCulled)\n                      {\n                          return vec4(0.0, 0.0, 0.0, 1.0);\n                      }\n                      vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);\n                      vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);\n                      if (prevSegmentCulled)\n                      {\n                          directionToPrevWC = -directionToNextWC;\n                      }\n                      else if (nextSegmentCulled)\n                      {\n                          directionToNextWC = -directionToPrevWC;\n                      }\n                      vec2 thisSegmentForwardWC, otherSegmentForwardWC;\n                      if (usePrevious)\n                      {\n                          thisSegmentForwardWC = -directionToPrevWC;\n                          otherSegmentForwardWC = directionToNextWC;\n                      }\n                      else\n                      {\n                          thisSegmentForwardWC = directionToNextWC;\n                          otherSegmentForwardWC =  -directionToPrevWC;\n                      }\n                      vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);\n                      vec2 leftWC = thisSegmentLeftWC;\n                      float expandWidth = width * 0.5;\n                      if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n                      {\n                          vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);\n                          vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;\n                          float leftSumLength = length(leftSumWC);\n                          leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);\n                          vec2 u = -thisSegmentForwardWC;\n                          vec2 v = leftWC;\n                          float sinAngle = abs(u.x * v.y - u.y * v.x);\n                          expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n                      }\n                      vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;\n                      return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;\n                  }\n                  vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n                  {\n                      vec4 positionEC = czm_modelViewRelativeToEye * position;\n                      vec4 prevEC = czm_modelViewRelativeToEye * previous;\n                      vec4 nextEC = czm_modelViewRelativeToEye * next;\n                      return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n                  }\n\n                  attribute vec3 position3DHigh;\n                  attribute vec3 position3DLow;\n                  attribute vec3 prevPosition3DHigh;\n                  attribute vec3 prevPosition3DLow;\n                  attribute vec3 nextPosition3DHigh;\n                  attribute vec3 nextPosition3DLow;\n                  attribute vec2 expandAndWidth;\n                  attribute vec2 st;\n                  attribute float batchId;\n\n                  varying float v_width;\n                  varying vec2 v_st;\n                  varying float v_polylineAngle;\n                  \n                  varying vec4 v_positionEC;\n                  varying vec3 v_normalEC;\n                  void main()\n                  {\n                  float expandDir = expandAndWidth.x;\n                  float width = abs(expandAndWidth.y) + 0.5;\n                  bool usePrev = expandAndWidth.y < 0.0;\n\n                  vec4 p = czm_computePosition();\n                  vec4 prev = czm_computePrevPosition();\n                  vec4 next = czm_computeNextPosition();\n                  \n                  float angle;\n                  vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n                  gl_Position = czm_viewportOrthographic * positionWC;\n                  \n                  v_width = width;\n                  v_st.s = st.s;\n                  v_st.t = st.t;\n                  // v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\n                  v_polylineAngle = angle;\n\n\n                  \n                  vec4 eyePosition = czm_modelViewRelativeToEye * p;\n                  v_positionEC =  czm_inverseModelView * eyePosition;      // position in eye coordinates\n                  //v_normalEC = czm_normal * normal;                         // normal in eye coordinates\n                  }\n\n    ",
                    // vertexShaderSource:Cesium.VertexFormat.DEFAULT ,
                    fragmentShaderSource: eval("fragmentShaderSource".concat(type))
                });
                return aper;
            }
        }
    });

}